/*
 
 Ye olde temperature converter that would've helped you not flunk that high
 school physics class back in the day. Also some good practice for C.

 Copyright 2022 - kzimmermann <https://tilde.town/~kzimmermann>

 This program is Free Software licensed under the GNU General Public License
 v3. See <https://www.gnu.org/licenses> for more information.

 */

#include <stdio.h>
#include <stdlib.h>
#include "converter.h"

/**
 This bit is some documentation for Doxygen. Here's how to use this program:
   
   tempconv OP INPUT_TEMP

 Where OP is either one of:

   cf - Celsius to Fahrenheit
   fc - Fahrenheit to Celsius
   ck - Celsius to Kelvin
   kc - Kelvin to Celsius
 
 INPUT_TEMP will be cast to float regardless of operation.
*/

int
main(int argc, char* argv[])
{
    float input;

    if (argc == 1) {
        input = 26.0;
    }
    else {
        input = atof(argv[1]);
    }
    printf("%.2f Celsius is %.2f Fahrenheit\n", input, ctof(input));
    printf("%.2f Fahrenheit is %.2f Celsius\n", input, ftoc(input));
    printf("%.2f Fahrenheit is %.2f Kelvin\n", input, ftok(input));
    printf("%.2f Kelvin is %.2f Fahrenheit\n", input, ktof(input));

    return 0;
}
